<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>个人资料</title>
    <meta name="keywords" content="个人资料"/>
    <meta name="description" content="个人资料"/>
    <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport" content="width=device-width,viewport-fit=cover">
    <link th:href="@{/shoppingApi/css/public.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/publicOfuser.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/combtn.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/accsetting.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/weui.min.css}" rel="stylesheet">
    <link th:href="@{/shoppingApi/css/jquery-weui.min.css}" rel="stylesheet">
    <meta name="_csrf" th:content="${_csrf.token}"/>
    <meta name="_csrf_header"  th:content="${_csrf.headerName}"/>
</head>
<body>

<div class="main accsetting">

    <div class="main_con c323232 withdraw">

        <div class="userinfo title">
            <span>个人资料</span>
        </div>

        <div class="mt10 pl15 pr15 height44 bgfff flex flex-pj flex-ac item">
            <label for="name" class="ft16">用户名</label>
            <div><input id="name" class="ft16" type="text" th:value="${userInfo.userInfo.userNo}" readonly></div>
        </div>

        <div class="mt1 pl15 pr15 height44 bgfff flex flex-pj flex-ac item">
            <label for="telephone" class="ft16">手机号</label>
            <div><input id="telephone" class="ft16" type="text" th:value="${userInfo.userInfo.phone}" readonly></div>
        </div>

        <div class="mt10 pl15 pr15 height44 bgfff flex flex-pj flex-ac item">
            <label for="nickname" class="ft16">昵称</label>
            <div><input id="nickname" class="ft16" type="text" th:value="${userInfo.userInfo.name}"></div>
        </div>

        <!--<div class="mt1 pl15 pr15 height44 bgfff flex flex-pj flex-ac item">-->
            <!--<label class="ft16">性别</label>-->
            <!--<div>-->
                <!--<input style="width:auto;" name="gender" class="ft16" type="radio">男&nbsp;&nbsp;-->
                <!--<input style="width:auto;" name="gender" class="ft16" type="radio">女-->
            <!--</div>-->
        <!--</div>-->

        <div class="pl5 pr15 mt40"><a class="submit  button red bigrounded">保存</a></div>
    </div>

</div>
</body>
<script th:src="@{/shoppingApi/js/jquery-3.3.1.min.js}"></script>
<script th:src="@{/shoppingApi/js/jquery-weui.min.js}"></script>
<script>
    var header = $("meta[name='_csrf_header']").attr("content");
    var token =$("meta[name='_csrf']").attr("content");
    $(function () {
        if(navigator.userAgent.indexOf("Html5Plus") > -1){
            $('.userinfo.title').hide();
        }
        $('#name').focus();
        $.toast.prototype.defaults.duration = 1000;
        $('.submit').on('click',function () {
            $.confirm( '确定修改？', '', function() {
                //点击确认后的回调函数
                var nickName=$.trim($("#nickname").val());
                $.ajax({
                    url: '/wap/addProfile?nickName='+nickName,
                    type: 'post',
                    dataType: 'json',
                    contentType: 'application/json',
                    async: false,
                    success: function(data){
                        if(data.data>0){
                            $.toast('保存成功~', 'text');
                            history.back()
                        }else {
                            $.toast('保存失败~', 'text');
                        }
                    },
                    beforeSend : function(xhr) {
                        xhr.setRequestHeader(header, token);
                    }
                });
            }, function() {
                //点击取消后的回调函数
                $.toast('修改已取消', 'cancel')
            });

        });
    })
</script>
</html>